<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">

<head>
    <title>个人信息</title>
    <th:block th:replace="/backstage/common_resources::common_css"></th:block>
    <th:block th:replace="/backstage/common_resources::common_js"></th:block>
</head>

<body class="hold-transition skin-purple sidebar-mini">

<header th:replace="~{/backstage/common_header::header}"></header>
<aside th:replace="~{/backstage/common_aside::aside}"></aside>

    <div class="wrapper">
        <div class="content-wrapper">

            <!-- 内容头部 -->
            <section class="content-header">
                <h1>
                    个人管理
                    <small>修改个人</small>
                </h1>
                <ol class="breadcrumb">
                    <li><a th:href="@{/backstage/index}"><i class="fa fa-dashboard"></i> 首页</a></li>
                    <li><a th:href="@{/backstage/users/all}">个人管理</a></li>
                    <li class="active">修改个人</li>
                </ol>
            </section>
            <!-- 内容头部 /-->

            <!-- 正文区域 -->
            <section class="content">
                <form th:action="@{/backstage/users/myUpdate}" method="post">
                    <input type="hidden" th:value="${user.uid}" name="uid">
<!--                    <div class="tab-pane" id="tab-common">-->
                        <div class="row data-type">

                            <div class="col-md-2 title">工号</div>
                            <div class="col-md-4 data">
                                <input type="text" class="form-control" placeholder="工号" name="username" th:value="${user.username}" readonly="readonly">
                            </div>

                            <div class="col-md-2 title">姓名</div>
                            <div class="col-md-4 data">
                                <input type="text" class="form-control" placeholder="姓名" name="name" th:value="${user.name}">
                            </div>

                            <div class="col-md-2 title">新密码</div>
                            <div class="col-md-4 data">
                                <input type="password" class="form-control" placeholder="新密码" name="password" th:value="${user.password}">
                            </div>


                            <div class="col-md-2 title">地址</div>
                            <div class="col-md-4 data">
                                <input type="text" class="form-control" placeholder="地址" name="address" th:value="${user.address}">
                            </div>

                            <div class="col-md-2 title">电话</div>
                            <div class="col-md-4 data">
                                <input type="text" id="phoneNum" class="form-control" placeholder="电话(请输入11位数字)" name="phoneNum" th:value="${user.phoneNum}"   oninput = "value=value.replace(/[^\d]/g,'')">
                                <script>
                                    $("#phoneNum").change(function () {
                                        if ($(this).val().length!=11){
                                            $(this).val("");

                                        }
                                    })
                                </script>
                            </div>

                            <div class="col-md-2 title">工龄</div>
                            <div class="col-md-4 data">
                                <input type="number" class="form-control" placeholder="工龄" name="workAge" th:value="${user.workAge}"  sec:authorize="hasAnyAuthority('/boss')">
                                <input type="number" class="form-control" placeholder="工龄" name="workAge" th:value="${user.workAge}"  sec:authorize="hasAnyAuthority('/worker')" readonly="readonly">
                            </div>



                            <div class="col-md-2 title">部门</div>
                            <div class="col-md-4 data">
                                <input type="text" class="form-control" placeholder="部门" name="department" th:value="${user.department}" readonly="readonly">
                            </div>

                            <div class="col-md-2 title">性别</div>
                            <div class="col-md-4 data" th:if="${user.sex}=='男'">
                                <input type="radio" name="sex" value="男" checked>男
                                <input type="radio" name="sex" value="女">女

                            </div>
                            <div class="col-md-4 data" th:if="${user.sex}=='女'">
                                <input type="radio" name="sex" value="男">男
                                <input type="radio" name="sex" value="女" checked>女

                            </div>


                                <span th:text="${message}" style="color: red"></span>



                            <div class="col-md-2 title"></div>
                            <div class="col-md-10 data text-center">
                                <button type="submit" class="btn bg-maroon">保存</button>
                                <button type="button" class="btn bg-default" onclick="history.back(-1);">返回</button>
                            </div>

                        </div>
<!--                    </div>-->
                </form>
                
            </section>
            <!-- 正文区域 /-->
        </div>
    </div>

<footer th:replace="~{/backstage/common_footer::footer}"></footer>

</body>

</html>